<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.25">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
span.s1 {font: 18.0px Helvetica}
span.s2 {color: #0000bf}
span.s3 {color: #007300}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1"><b>SinGrainBF<span class="Apple-tab-span">	</span></b></span><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>granular synthesis with sinusoidal grains with Ambisonic panning</b></p>
<p class="p2"><br></p>
<p class="p1"><b><span class="Apple-converted-space"> </span>*ar(trigger, dur, freq, azimuth, elevation, rho, wComp, mul, add)<span class="Apple-converted-space"> </span></b></p>
<p class="p2"><br></p>
<p class="p1"><b><span class="Apple-tab-span">	</span>trigger </b>- a kr or ar trigger to start a new grain. If ar, grains after the start of the synth are sample accurate.</p>
<p class="p1"><span class="Apple-tab-span">	</span>The following args are polled at grain creation time</p>
<p class="p1"><span class="Apple-tab-span">	</span><b>dur</b> - size of the grain.</p>
<p class="p1"><span class="Apple-tab-span">	</span><b>freq</b> - the freq of the grain generators internal oscillator</p>
<p class="p1"><span class="Apple-tab-span">	</span><b>azimuth</b> -<span class="Apple-converted-space">  </span>in radians, -pi to pi</p>
<p class="p1"><b><span class="Apple-tab-span">	</span>elevation</b> -<span class="Apple-converted-space">  </span>in radians, -0.5pi to +0.5pi</p>
<p class="p1"><span class="Apple-tab-span">	</span><b>rho</b> - the speaker radius (1 places shound at the radius, &lt;1 within the radius, &gt;1 is outside the radius)</p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>beyond the radius, nothing happens.</p>
<p class="p1"><b><span class="Apple-tab-span">	</span>wComp</b> - chooses how the W channels is scaled. If 0, a scaler of 0.707 is used. If 1, W is varied according<span class="Apple-converted-space"> </span></p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>to the scaling of the X, Y and Z channels. 0 is the default.</p>
<p class="p2"><br></p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p1"><b>Examples:</b></p>
<p class="p3"><br></p>
<p class="p4">s.boot;</p>
<p class="p3"><br></p>
<p class="p4"><span class="s2">SynthDef</span>(<span class="s3">\sin_grain_test</span>, {<span class="s2">arg</span> gate = 1, amp = 1;</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, trig;</p>
<p class="p4"><span class="Apple-tab-span">	</span>trig = <span class="s2">Impulse</span>.kr(20);</p>
<p class="p4"><span class="Apple-tab-span">	</span>#w, x, y, z = <span class="s2">SinGrainBF</span>.ar(trig, 0.05, <span class="s2">WhiteNoise</span>.kr.range(440, 880),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">WhiteNoise</span>.kr.range(-0.25pi, 0.25pi), 0, 1,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">EnvGen</span>.kr(</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">Env</span>([0, 1, 0], [1, 1], <span class="s3">\sin</span>, 1),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>gate,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>levelScale: amp,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>doneAction: 2)</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>);</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s2">Out</span>.ar(0, <span class="s2">DecodeB2</span>.ar(4, w, x, y));</p>
<p class="p4"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p3"><span class="Apple-tab-span">	</span></p>
<p class="p4">s.sendMsg(<span class="s3">\s_new</span>, <span class="s3">\sin_grain_test</span>, a=s.nextNodeID, 0, 1, <span class="s3">\amp</span>, 0.2);</p>
<p class="p4">s.sendMsg(<span class="s3">\n_set</span>, a, <span class="s3">\gate</span>, 0);</p>
</body>
</html>
